package YAPserver.gameObjects;

/**
 * This class contains the basics for the vectorgeometrie, which is used to generate the PlayGround
 * and to calculate the ballspeed and directions etc.
 * @author DMiagi
 *
 */
@Deprecated
public class Vector {

	private double x,y;
	
	public Vector(double x, double y){
		this.x=x;
		this.y=y;
	}
	public double getX(){
		return x;
	}
	public double getY(){
		return y;
	}
	public void setX(double x){
		this.x=x;
	}
	public void setY(double y){
		this.y=y;
	}
	
	public Vector add(Vector vec){
		return new Vector(this.x+vec.x, this.y+vec.y);
	}
	public void addInplace(Vector vec){
		this.x+=vec.x;
		this.y+=vec.y;
	}
	
	public Vector sub(Vector vec){
		return new Vector(this.x-vec.x, this.y-vec.y);
	}
	public void subInplace(Vector vec){
		this.x-=vec.x;
		this.y-=vec.y;
	}
	public void invert(){
		this.x=-this.x;
		this.y=-this.y;
	}
	public Vector mult(double k){
		return new Vector(this.x*k,this.y*k);
	}
	public void multInplace(double k){
		this.x*=k;
		this.y*=k;
	}
	public double dotP(Vector vec){
		return this.x*vec.x+this.y*vec.y;
	}
	public double lengthsquare(){
		return this.x*this.x+this.y*this.y;
	}
	
	public String toString(){
		return ("[x="+this.x+" y="+this.y+"]");
	}
}
